<template>
    <div class="mui-numbox" data-numbox-min='1' style="height: 25px;"> <!--去掉 :data-numbox-max='max'-->
        <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
        <input id="test" class="mui-input-numbox" type="number" :value="initcount"
               @change="countChanged" ref="numbox" readonly /> <!--change监听数据改变, ref="numbox"通过引用对象拿到原生对象 -->
        <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
    </div>
</template>

<script>
    import mui from '../../lib/mui/js/mui.min.js'
    export default {
        //name: "goodsinfo_numberbox"
        mounted() {
            //初始化数字选择框
            mui(".mui-numbox").numbox();
        },
        methods:{
            countChanged(){
                //数量改变
                console.log(this.$refs.numbox.value)
                this.$store.commit("upDateGoodsInfo",{
                    id:this.goodsid,
                    count:this.$refs.numbox.value
                })
            }
        },
        props:['initcount','goodsid']
    }
</script>

<style scoped lang="scss">

</style>